package dao.pojo;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "writing", catalog = "makeiteasy")
public class Writing implements java.io.Serializable {

	// Fields
	private static final long serialVersionUID = 1L;
	private Integer writeId;
	private String writeDriection;
	private String writeContent;
	private String writeUrl;
	private Set<Test> tests = new HashSet<Test>(0);

	// Constructors

	/** default constructor */
	public Writing() {
	}

	/** full constructor */
	public Writing(String writeDriection, String writeContent, String writeUrl,
			Set<Test> tests) {
		this.writeDriection = writeDriection;
		this.writeContent = writeContent;
		this.writeUrl = writeUrl;
		this.tests = tests;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "writeId", unique = true, nullable = false)
	public Integer getWriteId() {
		return this.writeId;
	}

	public void setWriteId(Integer writeId) {
		this.writeId = writeId;
	}

	@Column(name = "writeDriection", length = 512)
	public String getWriteDriection() {
		return this.writeDriection;
	}

	public void setWriteDriection(String writeDriection) {
		this.writeDriection = writeDriection;
	}

	@Column(name = "writeContent", length = 2024)
	public String getWriteContent() {
		return this.writeContent;
	}

	public void setWriteContent(String writeContent) {
		this.writeContent = writeContent;
	}

	@Column(name = "writeURL", length = 40)
	public String getWriteUrl() {
		return this.writeUrl;
	}

	public void setWriteUrl(String writeUrl) {
		this.writeUrl = writeUrl;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "writing")
	public Set<Test> getTests() {
		return this.tests;
	}

	public void setTests(Set<Test> tests) {
		this.tests = tests;
	}

}